package com.wuhuahe.luanfeng.netty.example.privateprotocol;

import org.jboss.marshalling.*;

import java.io.IOException;

/**
 * Created By wuhuahe
 * author:游龙
 * Date: 2018-07-14
 * Time: 10:23
 * Desc:
 */
public class MarshallingCodecFactory {

    public static Marshaller buildMarshalling() throws IOException {
        MarshallerFactory marshallerFactory = Marshalling.getProvidedMarshallerFactory("serial");
        MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration();
        marshallingConfiguration.setVersion(5);
        return marshallerFactory.createMarshaller(marshallingConfiguration);
    }

    public static Unmarshaller buildUnMarshalling() throws IOException {
        MarshallerFactory marshallerFactory = Marshalling.getProvidedMarshallerFactory("serial");
        MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration();
        marshallingConfiguration.setVersion(5);
        return marshallerFactory.createUnmarshaller(marshallingConfiguration);
    }
}
